/*
 * @Author: your name
 * @Date: 2021-05-24 10:19:14
 * @LastEditTime: 2021-05-24 14:37:16
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \5.24\dan\vue.config.js
 */
const { list } = require('./src/mock/data')

const bodyParser = require('body-parser')

module.exports = {
    devServer: {
        before(app) {
            app.use(bodyParser.json())

            app.get('/api/list', (req, res) => {
                res.send({
                    code: 200,
                    list
                })
            })
            app.post('/api/login', (req, res) => {
                let { user, pwd } = req.body
                if (user === 'admin' && pwd === 'zxcvbnm') {
                    res.send({
                        code: 200,
                        mess: '登录成功'
                    })
                }
            })
        }
    }
}